//
//  SelectAddressTableViewCell.m
//  JiuJiuShangCheng
//
//  Created by jiujiukeji on 2018/7/13.
//  Copyright © 2018年 jiujiukeji. All rights reserved.
//

#import "SelectAddressTableViewCell.h"

@implementation SelectAddressTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setUpUI];
    }
    return self;
}
- (void)setUpUI
{
    WeakSelf
    self.arrow = [[UIImageView alloc] init];
    _arrow.image = UIImageNamed(@"rightArrow");
    [_arrow sizeToFit];
    [self addSubview:_arrow];
    [_arrow mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self);
        make.right.equalTo(self).offset(-rateWidth(30));
    }];
    
    self.nameLB = [UILabel labelWithText:@"姓名" textColor:UIColorFromRGB(0x323232) fontSize:15];
    [_nameLB sizeToFit];
    [self addSubview:_nameLB];
    [_nameLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self).offset(rateHeight(25));
        make.left.equalTo(self).offset(rateWidth(70));
    }];
    
    self.tagLB = [UILabel labelWithText:@"默认" textColor:UIColorFromRGB(0xf55555) fontSize:10];
    _tagLB.textAlignment = NSTextAlignmentCenter;
    _tagLB.layer.borderColor = UIColorFromRGB(0xf55555).CGColor;
    _tagLB.layer.borderWidth = 0.5;
    _tagLB.layer.cornerRadius = 3;
    [self addSubview:_tagLB];
    [_tagLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(weakSelf.nameLB);
        make.left.equalTo(weakSelf.nameLB.mas_right).offset(rateWidth(25));
        make.size.mas_offset(CGSizeMake(rateWidth(100), rateHeight(40)));
    }];
    self.tagLB.hidden = YES;
    
    self.addressLB = [UILabel labelWithText:@"地址：请添加收货地址" textColor:UIColorFromRGB(0x909090) fontSize:13];
    [_addressLB sizeToFit];
    _addressLB.numberOfLines = 0;
    [self addSubview:_addressLB];
    [_addressLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.nameLB);
        make.width.mas_lessThanOrEqualTo(@(rateWidth(550)));
        make.top.equalTo(weakSelf.nameLB.mas_bottom).offset(rateHeight(25));
    }];
    
    self.iconImg = [[UIImageView alloc] init];
    _iconImg.image = UIImageNamed(@"buydingwei");
    [_iconImg sizeToFit];
    [self addSubview:_iconImg];
    [_iconImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(weakSelf.addressLB.mas_left).offset(-rateWidth(15));
        make.centerY.equalTo(weakSelf.addressLB);
    }];
    
    UIImageView *lineImg = [[UIImageView alloc] init];
    lineImg.image = UIImageNamed(@"bottomline");
    [lineImg sizeToFit];
    [self addSubview:lineImg];
    [lineImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.equalTo(self);
    }];
    
}

@end
